﻿using System;

namespace CC.Yacht
{
    public static class ErrorTypeExtensions
    {
        public static string ToStringEx(this ErrorType errorType)
        {
            switch (errorType)
            {
                case ErrorType.DatabaseError:
                    {
                        return "A database error occurred.";
                    }
                case ErrorType.DuplicateUser:
                    {
                        return "A user with the same email address already exists.";
                    }
                case ErrorType.InvalidUser:
                    {
                        return "Invalid user supplied.";
                    }
                case ErrorType.None:
                    {
                        return string.Empty;
                    }
                case ErrorType.SessionExpired:
                    {
                        return "Session expired.";
                    }
                case ErrorType.Unknown:
                    {
                        return "An unknown error occurred.";
                    }
                default:
                    {
                        throw new ArgumentException(errorType + " is undefined.", "errorType");
                    }
            }
        }
    }
}
